#ifndef FLOW_H
#define FLOW_H
#include "include/test_utils.h"
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#define FLOW_MAX_NUM 100

typedef struct
{
    int id;
    int src;
    int dst;
	int critical;
	// 单位：bytes
    int size;
    // 周期：单位 us
    int period;
    int relative_dl;
	// 最坏情况传输时间, cw = CBIT_WRITE * size * 8, cr = CBIT_READ * size * 8
	double cw;
	double cr;
    double wcrt;
    int priority;
    int new_priority;
    int old_priority;
    int final_priority;
    bool is_scheduled;
} flow;

// flow 定义数组，起始序号为 1
extern flow flows[FLOW_MAX_NUM];
extern int  flow_num;
extern u64 HP[VM_NUM];

void init_flows();

int get_flow_src(int flow_id);

int get_flow_dst(int flow_id);

void debug_flows();

void get_HP();
#endif